package com.showtao.front.domain.converter;

import javax.persistence.AttributeConverter;

import com.showtao.common.util.EnumHelper;
import com.showtao.front.domain.ArticleStatus;

public class ArticleStatusConverter implements AttributeConverter<ArticleStatus, String> {

    @Override
    public String convertToDatabaseColumn(ArticleStatus attribute) {
        return attribute.getCode();
    }

    @Override
    public ArticleStatus convertToEntityAttribute(String dbData) {
        return EnumHelper.translate(ArticleStatus.class, dbData);
    }

}
